package org.crazyit.cloud;

import java.util.Collections;
import java.util.List;

import org.springframework.beans.factory.SmartInitializingSingleton;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.web.client.RestTemplate;

@Configuration
public class MyConfig {
	
	@Autowired(required=false)
	@MyLoadBalanced
	private List<RestTemplate> tpls = Collections.emptyList();
	
	public SmartInitializingSingleton lbInitializing() {
		return new SmartInitializingSingleton() {
			
			public void afterSingletonsInstantiated() {
				for (RestTemplate tpl : tpls) {
					List<ClientHttpRequestInterceptor> interceptors = tpl.getInterceptors();
				}
			}
		};
	}
	
}














